import React from 'react'
import { Space, notification } from 'antd';
import { useImperativeHandle, forwardRef } from 'react'
type NotificationType = 'success' | 'info' | 'warning' | 'error';
type Props = {

}
export default forwardRef(function Appnotifycation({ }: Props, ref: any) {
    const [api, contextHolder] = notification.useNotification();
    const openNotificationWithIcon = (type: NotificationType, description: string) => {
        api[type]({
            message: '提示',
            description: description,
            duration: 1
        });
    };

    useImperativeHandle(ref, () => {
        return {
            openNotificationWithIcon
        }
    })

    return (
        <Space>
            {contextHolder}
        </Space>
    )
})